package cn.dhn_app.horseman_app.controller;

import cn.dhn_app.horseman_app.service.HorsemanMenuService;
import cn.itcast.util.ResponseEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author lyy
 * @Description TODO
 * @PACKAGE_NAME: cn.dhn_app.horseman_app.controller
 * @ClassName HorsemanMenuController
 * @Date 2020/8/27 16:00
 * @DAY_NAME_FULL: 星期四
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping(value = "/dhn/menu",produces = "application/json;charset=UTF-8")
public class HorsemanMenuController {


    @Resource
    private HorsemanMenuService horsemanMenuService;

    @RequestMapping(value = "/findAll")
    public ResponseEntity MenuFindAll(){

        log.info("获取首页菜单栏数据。。。。。");

        return horsemanMenuService.MenuFindAll();
    }


    @RequestMapping(value = "/account")
    public ResponseEntity Horseman_Account(@RequestHeader(value = "token")String token,
                                           @RequestBody Map<String,String> map){

        log.info("获取骑手账户信息。。。。。");

        String openId = map.get("openId");

        return horsemanMenuService.Horseman_Account(token,openId);
    }


    /**
     * 功能描述: <br>
     * 〈今日货重〉
     * @Author: lyy
     * @Date: 2020/10/21 15:48
     * @Param: [token, map]
     * @Return: cn.itcast.util.ResponseEntity
     */
    @RequestMapping(value = "/todayWeight")
    public ResponseEntity Today_Weight(@RequestHeader(value = "token")String token,
                                       @RequestBody Map<String,String> map){

        log.info("获取骑手今日货重信息。。。。。");

        String openId = map.get("openId");

        return horsemanMenuService.Today_Weight(token,openId);
    }
}
